package com.xjj.datarources.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjj.datarources.dao.QuerVoMapper;
import com.xjj.datarources.dao.QueryPoJoMapper;
import com.xjj.datarources.pojo.QueryPoJo;
import com.xjj.datarources.service.QueryVoService;
import com.xjj.datarources.vo.QueryVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @name: xjj
 * @date: 2021/5/21 13:26
 */
@Service
public class QueryVoImpl extends ServiceImpl<QuerVoMapper, QueryVo> implements QueryVoService {


    @Resource
    private QuerVoMapper querVoMapper;

    @Resource
    private QueryPoJoMapper queryPoJoMapper;



    @Override
    public QueryVo getById(String id) {

        QueryWrapper<QueryPoJo> queryPoJoQueryWrapper= new QueryWrapper<>();

        queryPoJoQueryWrapper.eq("vid", id);
        queryPoJoQueryWrapper.orderByAsc("id");
        QueryVo queryVo = querVoMapper.selectById(id);
        queryVo.setQueryPoJos(queryPoJoMapper.selectList(queryPoJoQueryWrapper));
        return queryVo;

    }

    @Override
    public void addQuery(QueryVo queryVo) {

    }


}
